﻿@using Phatent.Model.Pages

@{
    Layout = "~/Areas/Home/Views/Shared/_LeftSubNavLayout.cshtml";
}

<div class="t1">
    @if (Phatent.Website.WebContext.Language == "zh")
    {
        @(((CaseModel)ViewBag.Case).CaseName)
        <span>您当前位置：首页 > @(((CaseModel)ViewBag.Case).ParentCase.CaseName) > @(((CaseModel)ViewBag.Case).CaseName)</span>
    }else{
        @(((CaseModel)ViewBag.Case).EName)
        <span>Your Location：Home > @(((CaseModel)ViewBag.Case).ParentCase.EName) > @(((CaseModel)ViewBag.Case).EName)</span>
    }
</div>
<div>
    <ul class="txtList"></ul>
    <div style="text-align: center;">
        <div id="paginator"></div>
    </div>
</div>
<script>
    $("#paginator").bootstrapPaginator({
        //bootstrapMajorVersion: 3,
        currentPage: 1,
        totalPages: 1,
        onPageChanged: function (e, o, n) {
            GetList(n - 1);
        }
    });

    function GetList(pi) {
        var pageSize = 10;
        var lst = Whale.Remote.GetCollection({
            url: "/Home/GetPages",
            parameters: {
                pageSize: pageSize,
                pageIndex: pi,
                caseID: "@(((CaseModel)ViewBag.Case).ID)",
                visible:true
            }
        });

        if (lst != null) {
            var tp = lst.Total / pageSize + (lst.Total % pageSize > 0 ? 1 : 0)
            $("#paginator").bootstrapPaginator({ totalPages: tp });

            var html = "";
            $.each(lst.Data, function (i, o) {
                html += "<li>";
                @if (Phatent.Website.WebContext.Language=="zh"){
                    <text>html += "● <a href='" + o.FriendUrl + "'>" + o.Title + "</a>";</text>
                }else{
                    <text>html += "● <a href='" + o.FriendUrl + "'>" + o.ETitle + "</a>";</text>
                }
                html += "<span>" + o.CreatedOn.substr(0, 10) + "</span></li>";
            });
            $(".txtList").html(html);
        }
    }
    GetList(0);
</script>
